package com.itheima.day05;

import jdk.management.resource.internal.inst.SocketOutputStreamRMHooks;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Dome01 {
    public static void main(String[] args) {
        Collection<String> collList = new ArrayList<>();

        collList.add("JavaEE企业级开发指南");
        collList.add("Oracle高级编程");
        collList.add("MySQL从入门到精通");
        collList.add("Java架构师之路");

        Iterator<String> iterator = collList.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }


        System.out.println("===============================================");

        Collection<String> collList2 = new ArrayList<>();

        collList2.add("JavaEE企业级开发指南");
        collList2.add("Oracle高级编程");
        collList2.add("MySQL从入门到精通");
        collList2.add("Java架构师之路");

        Iterator<String> iterator2 = collList2.iterator();
        while (iterator2.hasNext()) {
           String next =  iterator2.next();
            if (next.length() < 10) {
                System.out.println(next);
            }

        }

        System.out.println("===============================================");




        Collection<String> collList3 = new ArrayList<>();

        collList3.add("JavaEE企业级开发指南");
        collList3.add("Oracle高级编程");
        collList3.add("MySQL从入门到精通");
        collList3.add("Java架构师之路");

        Iterator<String> iterator3 = collList3.iterator();
        while (iterator3.hasNext()) {
            String next = iterator3.next();
            if (next.contains("Java")) {
                System.out.println(next);
            }
        }


        System.out.println("=================================================");

        Collection<String> collList4 = new ArrayList<>();
        collList4.add("JavaEE企业级开发指南");
        collList4.add("Oracle高级编程");
        collList4.add("MySQL从入门到精通");
        collList4.add("Java架构师之路");

        Iterator<String> iterator4 = collList4.iterator();

        while (iterator4.hasNext()) {
            String next = iterator4.next();
            if (next.contains("Oracle")) {
                iterator4.remove();

            } else {

                System.out.println(next);
            }
        }
    }
}
